﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

using ScreensInterfaces;

namespace ScreensRepo
{
    /// <summary>
    /// Interaction logic for GetInput.xaml
    /// </summary>
    public partial class ShowMessageScreen : ScreenBase
    {
        public ShowMessageScreen()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RaiseUserInputReadyEvent(new UserInputReadyEventArgs());
        }

        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            RaiseUserInputReadyEvent(new UserInputReadyEventArgs());
        }

        public override void UpdateScreen(ScreenInput input)
        {
            base.UpdateScreen(input);
            
            //since wf thread cannot change any thing on the ui
            //this is another way to marshal the change to ui thread
            //check http://www.albahari.com/threading/part2.aspx
            Action action = () => updateHeader();
            Dispatcher.Invoke(action);
        }

        private void updateHeader()
        {
            Header.Content = "." + Header.Content + ".";
        }
    }
}
